﻿using System;
using System.Collections.Generic;
using System.Xml.Serialization;
using DC2010.Objects.Base;
using DC2010.Objects.Common;
using DC2010.Objects.Structures;

namespace DC2010.Objects.Data
{
    [XmlInclude(typeof(TileTeleportData))]
    [Serializable]
    public class TileData : BaseData
    {
        public TileData()
        {
            //events
            OnEnterEffects = new List<KeyValue>();
            OnLeaveEffects = new List<KeyValue>();

            WallSet = "Grey_big";
        }

        public List<KeyValue> OnEnterEffects { get; set; } //(I)
        public List<KeyValue> OnLeaveEffects { get; set; } //(I)

        public TileType TileType { get; set; }

        public bool IsBreakable { get; set; }

        public int X { get; set; }
        public int Y { get; set; }

        public DungeonLoc Loc { get; set; }

        public string WallSet { get; set; }

        public List<ObjectOnTile> ObjectsOnTile { get; set; }



        public TileGfx Gfx
        {
            get
            {
                if (!string.IsNullOrEmpty(GfxId))
                {
                    return Root.I.TileSystem.GetGfx(GfxId);
                }

                return null;
            }
        }	
		
        private TileLogic _l;
        public TileLogic L
        {
            get
            {
                if (_l == null)
                    _l = new TileLogic(this);

                return _l;
            }
        }
    }
}
